<template>
    <div class="adderss-box">
        <img src="http://img.xianyufanshen.net//pay/images/zhifuchenggong@2x.png" alt="">
        <div v-if="lang=='zh' ">
            <h2 v-if="type==1">恭喜您，支付成功！</h2>
            <h2 v-else-if="type==2">您已拒绝售卖！</h2>
            <h2 v-else-if="type==3">恭喜您，发货成功！</h2>
            <h2 v-else-if="type==4">已成功申请关闭交易！</h2>
            <h2 v-else>您已确认收货</h2>
            <p v-if="type==1">已成功支付保证金，请按照订单提示进行下一步</p>
            <p v-if="type==2">平台已没收您的保证金，并通知对方该交易已关闭</p>
            <p v-if="type==3">请耐心等待平台收货后，进入下一步交易</p>
            <p v-if="type==4">平台已没收您的保证金，并通知对方该交易已关闭</p>
            <p v-if="type==5">对方也确认收货后，交易完成</p>
            <div class="btn" @click="goOrder">查看其他交易</div>
            <div class="btn2" @click="goIndex">返回首页</div>
        </div>
        <div v-else>
            <h2 v-if="type==1">Congratulations, payment success！</h2>
            <h2 v-else-if="type==2">You have refused to sell！</h2>
            <h2 v-else-if="type==3">Congratulations, delivery is successful！</h2>
            <h2 v-else-if="type==4">Successfully applied to close the transaction！</h2>
            <h2 v-else>You have confirmed the receipt!</h2>
            <p v-if="type==1">The deposit has been successfully paid, please follow the order prompts for the next step</p>
            <p v-if="type==2">The platform has forfeited your margin and notified the other party that the transaction has been closed</p>
            <p v-if="type==3">Please wait patiently for the platform to receive the goods and proceed to the next transaction</p>
            <p v-if="type==4">The platform has forfeited your margin and notified the other party that the transaction has been closed</p>
            <p v-if="type==5">After the other party confirms the receipt, the transaction is completed</p>
            <div class="btn" @click="goOrder">View other transactions</div>
            <div class="btn2" @click="goIndex">Back to home</div>
        </div>  
    </div>
</template>
<script>
import { postBond , getGoodsDetails ,} from '@/api/goods';
import { Loading,Toast,Cell, CellGroup ,RadioGroup, Radio,} from 'vant';

export default {
    name:'order',
    data (){
        return{
            lang:'zh',//当前网页语言类型 zh 中文  en 英语   
           userId:0,//用户id 
           type:1,//type=1购买，2置换 3、发布藏品
           status:1,//1购买 0置换
        }
    },
    //实例创建完成后被立即调用
    created (){
        //获得语言类型lang
        if(this.$route.query.lang) {
            this.lang = this.$route.query.lang;
        }
        //获取用户id
        if(this.$route.query.userId && this.$route.query.userId > 0){
            this.userId = this.$route.query.userId;
             //把用户id存储在缓存
             window.localStorage.setItem("userId",this.userId);
        }else{
            this.userId = window.localStorage.getItem("userId");
        }
        //获得订单类型
        if(this.$route.query.type && this.$route.query.type > 0){
            this.type = this.$route.query.type;
        }
        //获得状态
        if(this.$route.query.status){
            this.status = this.$route.query.status;
        }
    },
    //
    methods:{
        //返回首页
        goIndex(){
            let para = {};
            para.linkType = "index";
            this.interaction.hLinkToApp(para);	
        },
        //返回订单
        goOrder(){
            // let para = {};
            // if(this.lang == 'zh'){
            //     para.title = "订单";
            // }else{
            //     para.title = "order";
            // }
            // //先判断类型
            // if(this.status == 1){//售卖
            //     para.url = "/order?status=1&userId="+this.userId+"&lang="+this.lang;
            // }else{//置换
            //     para.url = "/order?status=0&userId="+this.userId+"&lang="+this.lang;
            // }
            // para.back = 'order';
            // this.interaction.hLink(para);

            //订单页--购买交易：orderbuy， 订单页--置换交易：orderchange)  
            let para = {};
            if(this.status == 1){  //status=1购买，0置换
                para.linkType = "orderbuy";
            }else if(this.status == 0){  //置换
                para.linkType = "orderchange";
            }
            para.lang = this.lang;//显示网页语言类型 zh中文 en英文
            this.interaction.hLinkToApp(para);	
        }
    }
    
}
</script>

<style lang="stylus" scoped>
.adderss-box{
    width :100%;
    height:100%;
    background :#fff;
    text-align:center;
    position:fixed;
    bottom :0;
    img{
        width:1.466667rem;
        height:1.466667rem;
        margin :0 auto;
        margin-top :1.066667rem;
    }
    h2{
        font-family:PingFangSC-Regular;
        font-size:.48rem;
        color:#494949;
        letter-spacing:.006667rem;
        text-align:center;
        margin-top :.266667rem;
        margin-bottom :1.333333rem;
    }
    p{
       font-family:PingFangSC-Regular;
        font-size:.373333rem;
        color:#494949;
        letter-spacing:.005067rem;
        text-align:center;
        line-height:.693333rem;
        padding 0 6%;
    }
    .btn{
        border:2px solid #cb9c57;
        border-radius:100px;
        width:6.426667rem;
        height:.96rem;
        line-height :.96rem;
        font-family:PingFangSC-Medium;
        font-size:.373333rem;
        color:#cb9c57;
        letter-spacing:.005067rem;
        text-align:center;
        margin :0 auto;
        margin-top :2rem;
    }
    .btn2{
        border :none;
        font-family:PingFangSC-Regular;
        font-size:.373333rem;
        color:#cb9c57;
        letter-spacing:.005067rem;
        text-align:center;
        margin-top :.533333rem;
     }
}
</style>


